import matplotlib.pyplot as plt


data = {
    "epsilon": [1, 0.8, 0.6, 0.4, 0.2, 0.1],
    "Grade 1": [9.56e-1, 2.87e-0, 2.58e-0, 2.26e-0, 1.94e-0, 1.82e-0],
    "Grade 2": [9.55e-1, 1.42e-0, 1.28e-0, 1.24e-0, 1.13e-1, 1.13e-0],
    "Grade 3": [1.82e-1, 4.69e-2, 3.20e-2, 3.77e-2, 5.71e-2, 8.22e-2],
    "Grade 4": [2.08e-3, 4.73e-3, 5.01e-3, 7.14e-3, 1.94e-2, 3.34e-2],
    "Grade 5": [5.21e-4, 3.66e-3, 3.89e-3, 6.29e-3, 1.23e-2, 2.43e-2],
    "Grade 6": [1.12e-4, 2.55e-3, 3.36e-3, 5.39e-3, 1.13e-2, 2.32e-2],
    "Grade 7": [1.08e-4, 1.96e-3, 2.64e-3, 4.41e-3, 1.09e-2, 2.29e-2],
    "Grade 8": [7.17e-5, 1.80e-3, 2.50e-3, 4.05e-3, 1.07e-2, 2.23e-2],
    "Grade 9": [6.92e-5, 6.28e-3, 3.43e-3, 6.02e-3, 1.25e-2, 2.38e-2],
    "Grade 10": [6.98e-5, None, None, None, None, None],
    "Grade 11": [None, None, None, None, None, None],
    "Grade 12": [None, None, None, None, None, None]
}

# Extracting data and plotting for each epsilon
plt.figure(figsize=(10, 6))
for i, epsilon in enumerate(data["epsilon"]):
    if epsilon != 0.01:  # Skip epsilon = 0.1 as it has invalid data
        values = [data[f"Grade {j}"][i] for j in range(1, 13)]
        plt.plot(range(1, 13), values, marker='o', label=f'$\epsilon$ = {epsilon}')

plt.xlabel('Grade')
plt.ylabel('RE')
#plt.title('Values vs Grade for Different $\epsilon$')
plt.xticks(range(1, 13))
plt.yscale('log')  # Setting y-axis to logarithmic scale
plt.legend()
plt.grid(True)
plt.ylim(1e-5, 10)
plt.savefig('../equ_multi.png')
plt.show()


data = {
    "epsilon": [1, 0.8, 0.6, 0.4, 0.2, 0.1],
    "Grade 1": [9.56e-1, 2.87e-0, 2.58e-0, 2.26e-0, 1.95e-0, 1.82e-0],
    "Grade 2": [9.47e-1, 1.35e-0, 1.27e-0, 1.15e-0, 1.11e-0, 1.14e-0],
    "Grade 3": [9.59e-3, 1.73e-2, 1.25e-2, 1.73e-2, 4.30e-2, 1.10e-1],
    "Grade 4": [2.82e-4, 4.75e-3, 3.72e-3, 6.05e-3, 1.75e-2, 4.30e-2],
    "Grade 5": [1.08e-4, 2.92e-3, 2.74e-3, 4.86e-3, 1.37e-2, 3.00e-2],
    "Grade 6": [4.76e-5, 2.10e-3, 2.27e-3, 3.89e-3, 1.15e-2, 2.40e-2],
    "Grade 7": [3.62e-5, 1.41e-3, 2.09e-3, 3.44e-3, 1.14e-2, 2.20e-2],
    "Grade 8": [4.35e-5, 1.27e-3, 1.76e-3, 3.14e-3, 1.13e-2, 3.06e-2],
    "Grade 9": [None, 1.93e-2, 1.48e-3, 2.87e-3, 1.25e-2, None],
    "Grade 10": [None, None, 6.20e-2, 2.60e-3, None, None],
    "Grade 11": [None, None, None, 2.32e-3, None, None],
    "Grade 12": [None, None, None, 1.53e-2, None, None]
}
# Extracting data and plotting for each epsilon
plt.figure(figsize=(10, 6))
for i, epsilon in enumerate(data["epsilon"]):
    if epsilon != 0.01:  # Skip epsilon = 0.1 as it has invalid data
        values = [data[f"Grade {j}"][i] for j in range(1, 13)]
        plt.plot(range(1, 13), values, marker='o', label=f'$\epsilon$ = {epsilon}')

plt.xlabel('Grade')
plt.ylabel('RE')
#plt.title('Values vs Grade for Different $\epsilon$')
plt.xticks(range(1, 13))
plt.yscale('log')  # Setting y-axis to logarithmic scale
plt.legend()
plt.grid(True)
plt.ylim(1e-5, 10)
plt.savefig('../inc_multi.png')
plt.show()


data = {
    "epsilon": [1, 0.8, 0.6, 0.4, 0.2, 0.1],
    "SGL-1": [9.56e-1, 2.47e-0, 2.23e-0, 1.98e-0, 1.78e-0, 1.71e-0],
    "SGL-2": [2.46e-3, 2.24e-2, 1.62e-2, 2.17e-2, 4.11e-2, 6.99e-2],
    "SGL-3": [5.38e-4, 2.58e-2, 1.95e-2, 2.70e-2, 3.52e-2, 4.89e-2],
    "SGL-4": [6.01e-4, 3.83e-2, 3.42e-2, 3.22e-2, 3.27e-2, 4.65e-2],
    "SGL-5": [2.42e-4, 5.79e-2, 3.55e-2, 4.33e-2, 7.52e-2, 8.78e-1],
    "SGL-6": [1.07e-3, 2.34e-1, 3.14e-1, 5.90e-1, 4.73e-2, 5.26e-2],
    "SGL-7": [7.00e-4, 1.24e-1, 1.68e-1, 2.12e-1, 4.51e-2, 3.27e-2],
    "SGL-8": [5.40e-4, 1.04e-2, 5.51e-3, 1.32e-2, 2.26e-2, 3.36e-2],
    "SGL-9": [4.84e-4, 3.99e-3, 5.50e-3, 8.96e-3, 1.37e-2, 5.55e-2],
    "SGL-10": [4.12e-4, 4.44e-3, 4.10e-3, 8.25e-3, 1.23e-2, 3.75e-2],
    "SGL-11": [3.53e-4, 3.98e-3, 4.63e-3, 7.28e-3, 1.26e-2, 2.51e-2],
    "SGL-12": [3.93e-4, 8.85e-3, 5.23e-3, 7.43e-3, 1.67e-2, 2.25e-2]
}

# Extracting data and plotting for each epsilon
plt.figure(figsize=(10, 6))
for i, epsilon in enumerate(data["epsilon"]):
    if epsilon != 0.01:  # Skip epsilon = 0.1 as it has invalid data
        values = [data[f"SGL-{j}"][i] for j in range(1, 13)]
        plt.plot(range(1, 13), values, marker='o', label=f'$\epsilon$ = {epsilon}')

plt.xlabel('SGL')
plt.ylabel('RE')
#plt.title('Values vs Grade for Different $\epsilon$')
plt.xticks(range(1, 13))
plt.yscale('log')  # Setting y-axis to logarithmic scale
plt.legend()
plt.grid(True)
plt.ylim(1e-5, 10)
plt.savefig('../equ_sal.png')
plt.show()

# Data from the table
data = {
    "epsilon": [1, 0.8, 0.6, 0.4, 0.2, 0.1],
    "SGL-1": [9.56e-1, 2.47e-0, 2.25e-0, 1.95e-0, 1.75e-0, 1.71e-0],
    "SGL-2": [5.03e-4, 2.36e-2, 1.60e-2, 1.76e-2, 3.50e-2, 6.23e-2],
    "SGL-3": [4.89e-4, 1.75e-2, 1.76e-2, 1.86e-2, 3.03e-2, 4.89e-2],
    "SGL-4": [3.27e-4, 3.01e-2, 3.25e-2, 3.30e-2, 3.05e-2, 4.14e-2],
    "SGL-5": [2.17e-4, 1.05e-1, 8.79e-2, 3.36e-1, 1.68e-1, 6.57e-2],
    "SGL-6": [7.50e-4, 5.85e-3, 7.20e-3, 1.01e-2, 2.27e-2, 3.77e-2],
    "SGL-7": [3.75e-4, 3.15e-3, 4.18e-3, 9.25e-3, 1.54e-2, 4.78e-2],
    "SGL-8": [2.27e-4, 2.45e-3, 4.05e-3, 4.88e-3, 1.30e-2, 2.83e-2],
    "SGL-9": [7.16e-4, 3.02e-3, 7.90e-3, 7.58e-3, 1.56e-2, 2.52e-2],
    "SGL-10": [1.01e-3, 5.77e-3, 9.49e-3, 7.64e-3, 2.28e-2, 3.30e-2],
    "SGL-11": [4.21e-4, 8.36e-3, 7.47e-3, 8.57e-3, 1.42e-2, 3.19e-2],
    "SGL-12": [3.72e-3, 6.83e-3, 8.36e-3, 1.03e-2, 1.99e-2, 3.52e-2]
}


# Extracting data and plotting for each epsilon
plt.figure(figsize=(10, 6))
for i, epsilon in enumerate(data["epsilon"]):
    if epsilon != 0.01:  # Skip epsilon = 0.1 as it has invalid data
        values = [data[f"SGL-{j}"][i] for j in range(1, 13)]
        plt.plot(range(1, 13), values, marker='o', label=f'$\epsilon$ = {epsilon}')

plt.xlabel('SGL')
plt.ylabel('RE')
#plt.title('Values vs Grade for Different $\epsilon$')
plt.xticks(range(1, 13))
plt.yscale('log')  # Setting y-axis to logarithmic scale
plt.legend()
plt.grid(True)
plt.ylim(1e-5, 10)
plt.savefig('../inc_sal.png')
plt.show()
